/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ibrae.mchs.radiation.entities;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "selsovet", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"ID_SELSOV"})})
@NamedQueries({
    @NamedQuery(name = "Selsovet.findAll", query = "SELECT s FROM Selsovet s"),
    @NamedQuery(name = "Selsovet.findByIdSelsov", query = "SELECT s FROM Selsovet s WHERE s.idSelsov = :idSelsov"),
    @NamedQuery(name = "Selsovet.findByPlacename", query = "SELECT s FROM Selsovet s WHERE s.placename = :placename"),
    @NamedQuery(name = "Selsovet.findByNumberPp", query = "SELECT s FROM Selsovet s WHERE s.numberPp = :numberPp")})
public class Selsovet implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_SELSOV", nullable = false)
    private Integer idSelsov;
    @Basic(optional = false)
    @Column(name = "PLACENAME", nullable = false, length = 50)
    private String placename;
    @Column(name = "NUMBER_PP", length = 4)
    private String numberPp;
    @OneToMany(mappedBy = "selsovet")
    private Set<Result> resultSet;
    @JoinColumn(name = "ID_SUBJECT", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private SubjectRf subjectRf;
    @JoinColumn(name = "ID_RAJON_O", referencedColumnName = "ID_RAJON_O", nullable = false)
    @ManyToOne(optional = false)
    private RajonOld rajonOld;
    @OneToMany(mappedBy = "selsovet")
    private Set<Geoobject> geoobjectSet;

    public Selsovet() {
    }

    public Selsovet(Integer idSelsov) {
        this.idSelsov = idSelsov;
    }

    public Selsovet(Integer idSelsov, String placename) {
        this.idSelsov = idSelsov;
        this.placename = placename;
    }

    public Integer getIdSelsov() {
        return idSelsov;
    }

    public void setIdSelsov(Integer idSelsov) {
        this.idSelsov = idSelsov;
    }

    public String getPlacename() {
        return placename;
    }

    public void setPlacename(String placename) {
        this.placename = placename;
    }

    public String getNumberPp() {
        return numberPp;
    }

    public void setNumberPp(String numberPp) {
        this.numberPp = numberPp;
    }

    public Set<Result> getResultSet() {
        return resultSet;
    }

    public void setResultSet(Set<Result> resultSet) {
        this.resultSet = resultSet;
    }

    public SubjectRf getSubjectRf() {
        return subjectRf;
    }

    public void setSubjectRf(SubjectRf subjectRf) {
        this.subjectRf = subjectRf;
    }

    public RajonOld getRajonOld() {
        return rajonOld;
    }

    public void setRajonOld(RajonOld rajonOld) {
        this.rajonOld = rajonOld;
    }

    public Set<Geoobject> getGeoobjectSet() {
        return geoobjectSet;
    }

    public void setGeoobjectSet(Set<Geoobject> geoobjectSet) {
        this.geoobjectSet = geoobjectSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSelsov != null ? idSelsov.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Selsovet)) {
            return false;
        }
        Selsovet other = (Selsovet) object;
        if ((this.idSelsov == null && other.idSelsov != null) || (this.idSelsov != null && !this.idSelsov.equals(other.idSelsov))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.Selsovet[idSelsov=" + idSelsov + "]";
    }

}
